//
//  Extension+UILabel.swift
//  STVVeibo
//
//  Created by leergou on 16/7/20.
//  Copyright © 2016年 WhiteHouse. All rights reserved.
//

import UIKit

extension UILabel{
    
    convenience init(font: CGFloat, textColor: UIColor, maxWidth: CGFloat = 0){
        self.init()
        
        self.textColor = textColor
        
        if font > 0 {
            self.font = UIFont.systemFontOfSize(font)
        } else {
            self.font = UIFont.systemFontOfSize(12)
        }
        
        if maxWidth > 0 {
            // 设置 label 的最大宽度
            self.preferredMaxLayoutWidth = maxWidth
            self.numberOfLines = 0
        }
    }
    
}
